
#ifndef __CE_UTILS_TRANSFORMER_H__
#define __CE_UTILS_TRANSFORMER_H__

#include <export.h>
#include <scene/entitynode.h>
#include <scene/node.h>
#include <vector>

/**
 * \addtogroup utils
 * @{
 */

/**
 * @brief Utility class for transforming several ceNode elements at once.
 */

class CE_API ceTransformer
{
private:
  struct Trans
  {
    ceEntityNode*   Entity;
    ceMatrix4f      OriginMatrix;
  };
  std::vector<Trans>  _transformations;

  ceMatrix4f          _transformation;
  ceMatrix4f          _transformationInv;

  void RemoveTrans (ceEntityNode* node);

public:
  ceTransformer();

  void Clear ();
  void AddNode (ceNode* node);
  void RemoveNode (ceNode* node);
  void Finish ();

  ceMatrix4f& GetTransformation ();
  void UpdateTransformation ();
  void ApplyTransformation ();
  void ResetTransformation ();

  unsigned GetNumberOfNodes () const;
  bool IsValid () const;

};

/** @} */

#endif /* !  __CE_UTILS_TRANSFORMER_H__ */

